
//载入模块儿
const express = require("express");
const http = require("http");

let fs = require("fs");
const app = express();
const path = require("path");
//监听事件

let server = http.createServer();
app.listen("5050",()=>{
	console.log("端口5050启用");
})
app.get("/",(req,res)=>{
	res.send("这是首页面");
})
app.get("/register",(req,res)=>{
	//console.log(path.join(__dirname, 'sendto.html'));
	res.sendFile(path.join(__dirname, 'sendto.html'));
})
app.get("/toregister",(req,res)=>{
	let {username,pwd,pwdagain} = req.query;
	if(username == "" || pwd == "" || pwdagain == "")
	{
		res.send(`<script>alert('提交信息不得为空');</script>`);
		return;
	}
	res.send(`处理新用户${username}${pwd}`)
})
app.all("*",(req,res)=>{
	res.send("404错误");
})
